﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace FixtureManageSystem.Converters
{
    class PersonNoConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string phrase = (string)value;
            string[] words = phrase.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            if (words.Length >= 2)
                return words[words.Length - 1];
            return phrase;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
